<template>
  <div class="supports">
    <el-form label-width="80px">
      <el-form-item label="支持金额">
        <el-input
          v-model="name"
          type="number"
          class="no-number"
          oninput="value=value.replace(/^\.+|[^\d.]/g,'')"
        ></el-input>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="onSubmit">确定</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  props: ["id"],
  data() {
    return {
      name: "",
    };
  },
  methods: {
    onSubmit() {
      if (this.name == "") {
        this.$message.error("请输入支持金额");
      } else {
        this.$http
          .postRequest("main/support/pay", {
            id: this.id,
            alIn: this.name,
            userId: sessionStorage.getItem("bfid"),
          })
          .then((res) => {
            console.log(res.data);
            if (res.code === 0) {
              setTimeout(() => {
                this.$bus.$emit("cl", 1);
              }, 500);
            }
          })
          .catch((error) => {
            console.log(error);
          });
      }
    },
  },
};
</script>

<style scoped>
</style>
